package com.only4play.authcenter.infrastructure.security.providers.admin.sms;

import lombok.Getter;
import lombok.Setter;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @author hinzzz www.hinzzz.cn 157957329@qq.com
 * 2024-03-05
 */

public class SmsToken extends AbstractAuthenticationToken {
    @Getter
    @Setter
    private String phone;
    @Getter
    @Setter
    private String verifyCode;

    /**
     * Creates a token with the supplied array of authorities.
     *
     * @param authorities the collection of <tt>GrantedAuthority</tt>s for the principal
     *                    represented by this authentication object.
     */
    public SmsToken(Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
    }



    @Override
    public Object getCredentials() {
        return verifyCode;
    }

    @Override
    public Object getPrincipal() {
        return phone;
    }

}
